package com.ricervcvcer.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ricervcvcer.user.entity.SysRole;
import com.ricervcvcer.user.mapper.SysRoleMapper;
import com.ricervcvcer.user.service.ISysRoleService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author moge
 * @since 2022-01-10
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {

    @Override
    public Page<SysRole> page(Integer page, Integer rows, String roleName) {
        // 创建分页对象
        Page<SysRole> sysRolePage = new Page<>(page, rows);
        QueryWrapper<SysRole> qw=new QueryWrapper();
        if(!StringUtils.isEmpty(roleName) && roleName!=""){
            qw.like("role_name",roleName);
        }
        qw.ne("role_flag",0);
        sysRolePage = this.baseMapper.selectPage(sysRolePage, qw);

        return sysRolePage;
    }
}
